package com.yuyue.dronesystem.enums;

import java.util.Objects;

/**
 * UserAuthority
 */
public enum UserAuthority {
    TOURISTS(0,"游客"),
    NOMAL_USER(1,"普通用户"),
    // JUNIOR_MEMBER(11,"初级会员"),
    // INTERMEDIATE_MEMBER(12,"中级会员"),
    // SENIOR_MEMBER(13,"高级会员"),
    ADMIN(21,"管理员");

    private Integer code;
    private String value;

    UserAuthority(Integer code, String value) {
        this.code = code;
        this.value = value;
    }

    public Integer getCode() {
        return this.code;
    }

    public String getValue() {
        return this.value;
    }
    
    public static UserAuthority fromValue(Integer code) {
        for (UserAuthority userAuthority : UserAuthority.values()) {
            if (Objects.equals(code, userAuthority.getCode())) {
                return userAuthority;
            }
        }
        throw new IllegalArgumentException();
    }
}